﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Text;
using System.Reflection;
using DevExpress.XtraTreeList.Handler;
using DevExpress.XtraTreeList;

namespace cnris.uc
{
    public partial class uTreeList : TreeList
    {
        private DragInsertDirection mDrAGInsertDirection;
        /// <summary>
        /// 判断当前是移动上下级还是移动到节点下一级
        /// </summary>
        public DragInsertDirection MDrAGInsertDirection
        {
            get { return mDrAGInsertDirection; }
        }

        public uTreeList()
        {
            InitializeComponent();
        }

        public uTreeList(IContainer container)
        {
            container.Add(this);

            InitializeComponent();
        }

        protected override void OnDragDrop(System.Windows.Forms.DragEventArgs drgevent)
        {
            FieldInfo fi = typeof(TreeListHandler).GetField("fStateData", BindingFlags.Instance | BindingFlags.NonPublic);
            StateData data = (StateData)fi.GetValue(Handler);
            fi = typeof(DragScrollInfo).GetField("dragInsertDirection", BindingFlags.Instance | BindingFlags.NonPublic);
            DragInsertDirection diDirection = (DragInsertDirection)fi.GetValue(data.DragInfo);
            mDrAGInsertDirection = diDirection;
            base.OnDragDrop(drgevent);
        }

    }
}
